<!--混凝土拌和站---动态监控--实时监控-->
<!--
 * @Author: 卡卡 1071780426@qq.com
 * @Date: 2022-12-02 13:13:25
 * @LastEditors: CNN 969682281@qq.com
 * @LastEditTime: 2023-11-10 14:06:04
 * @FilePath: \backstage - 副本\src\views\aa.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="department" id="department">
    <div class="department_right">
   
      <!-- 表格 -->
      <div class="text_table TensionRealTime">
        <commonPage
          :commonData="commonData"
          @searchForm="yj_searchForm(getList)"
        >
        </commonPage>
      </div>
    </div>
  </div>
</template>

<script>
// import messageBox from "@/components/public/messageBox"; //主页面分页
import actions from "@/actions";
// import tree from "@/components/public/pitchManage_tree"; //左侧机构树
import TableData from "@/components/pitchManage/dyMonitorManage/el-tables"; //主页面列表
// import TableData from '@/components/HntManage/el-tables';//主页面列表
import Pagination from "@/components/public/el-pagination"; //主页面分页
import commonPage from "@/components/pitchManage/dyMonitorManage/errorMonitoringPage"; //主页面列表
import formJs from "./regexDetail.js"; //新增弹框配置项
import {
  getAsphaltClosedLists, //主页面列表接口
  // getStationmachineList, //拌合站列表
  // getMachineListByStationId, //拌合机
  // getAsphaltRecipeListByCompanyId, // 查询-沥青混合料类型下拉框
} from "@/api/request.js";
// import { statusType } from "@/utils/config"; //配置项
export default {
  name: "errorMonitoringDetail",
  data() {
    return {
      name: "errorMonitoringDetail", //按钮配置页面代号
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        },
      },
      showMsgBox: false,
      msgTip: "请先选中数据行！",
      msgType: 1,
      timeDuring: [], //主页面日期筛选绑定值
      rowInfo: null, //当前行信息
      projectsObj: [], //项目名
      tendersObj: [],
      falgId: null,
      editLoading: false,
      sgcDataList: formJs.sgcDataList, //施工层位
      yjDataList: formJs.yjDataList, //预警级别
      liqhDataList: [], //沥青混合料类型
      formData: {}, //新增编辑向后台传递对象
      navigatepageNums: null, //是否显示分页
      queryCriteriaData: {}, //分页
      djDataList: formJs.djDataList,
      CloseoperationDataList: formJs.CloseoperationDataList,
      bhzDataList: [], //拌合站
      bhjDataList: [], //拌合机
      value2: "", //主页面日期筛选绑定值
      // 列表配置项
      table_config: formJs.cbtable_config,
      tableData: [], //表格列表数据列表
      highlightBd: true, //左侧机构树停留背景色
      treelength: false, //左侧树显示隐藏
      showName: "未选择公司",
      fId: null, //点击当前列表数据fId
      listLoading: false, //列表数据加载loading
      loadingEditDialog: false, //弹框loading
      dialogEditVisible: false, //新增弹框是否显示
      // 列表给后端传参
      getList: {
        fprojectid: "",
        fCompanyid: "", // 施工标段id
        startDates: "", // 开始时间
        endDates: "", // 截至时间
        stationId: "", //拌合站
        machineId: "", //拌合机
        fConstructionhorizon: "", // 施工层位
        fMixturetype: "", //  沥青混合料类型
        warningLevel: "", // 预警等级
        fCloseoperation: "", //闭合状态
        page: 1, // 当前页码
        pageSize: 20, // 每页显示条数
      },

      checkData: [], //树状图默认选中id
      userInfo: {}, //登录用户
      treeText: {
        //树状图参数
        companyId: null,
        userId: null,
        text: null,
      },
      dialogTitle: "编辑",
      headerData: [],
      commonData: {}, //弹框组件页面数据
    };
  },
  components: {
    TableData, //主页面列表
    Pagination, //分页
    commonPage,
  },
  mounted() {
    var that = this;
    actions.onGlobalStateChange((state, prev) => {
      this.userInfo = prev.currentUser;
      this.token = prev.token;
      // var data = prev.currentUser.projects;
      // this.projectsObj = [
      //   {
      //     fItemName: "所有项目",
      //     fItemValue: "",
      //   },
      // ];
      // data.map((item) => {
      //   this.projectsObj.push({
      //     fItemName: item.projectName,
      //     fItemValue: item.projectId,
      //   });
      // });
    }, true);
    this.yj_viewForm(JSON.parse(this.$route.query.data));

    // this.getDate();
  },
  methods: {
    confirmMsg() {
      this.showMsgBox = false;
    },


    // 获取列表数据
    yj_searchForm(data) {
      this.listLoading = true;
      window.sessionStorage.setItem(
        "GxEmbedded_pitchManage_getLists",
        JSON.stringify(data)
      );
      var id;
      if (data.fCompanyid != "") {
        id = data.fCompanyid;
      } else {
        id = data.fprojectid;
      }
      var sc = {
        fCompanyid: id, // 施工标段id
        startDates: data.startDates, // 开始时间
        endDates: data.endDates, // 截至时间
        stationId: data.stationId, //拌合站
        machineId: data.machineId, //拌合机
        fConstructionhorizon: "", // 施工层位
        fMixturetype: data.fMixturetype, //  沥青混合料类型
        warningLevel: data.warningLevel, // 预警等级
        fCloseoperation: data.fCloseoperation, //闭合状态
        page: data.page, // 当前页码
        pageSize: data.pageSize, // 每页显示条数
      };
      getAsphaltClosedLists(sc)
        .then((res) => {
          if (res.errcode == 0) {
            var that = this;
            that.listLoading = false;
            that.tableData = res.data.pageInfo.list;
            this.queryCriteriaData = res.data.pageInfo; //分页信息
            this.navigatepageNums =
              this.queryCriteriaData.navigatepageNums.length;
            // this.downloadExcel()
          } else {
            this.$message.error(res.msg);
            return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },

    // 查看
    yj_viewForm(row) {
      var id = row.fId;
      if (id != "" && id != null) {
        this.fId = row.fId;

        this.commonData = {
          data: row,
          companyId: row.fCompanyid,
        };
      } else {
        return this.$message.error("请先选择需要查看的数据");
      }
    },
  },
};
</script>
<style scoped lang="less">
.TensionRealTime {
  height: 100%;
  display: flex;
  flex-direction: column;
}

</style>
